package demo.cor2;

import lombok.Setter;

@Setter
public abstract class AbstractHandler implements Handler {
  private Handler nextHandler;
  
  @Override
  public void handler(Request request, Response response) {
    // 执行 handler 的核心处理器
    boolean ans = this.doHandler(request, response);
    
    // 如果是 true && 下一个handler 存在的话 直接下一个handler
    if (ans && this.nextHandler != null)
      this.nextHandler.handler(request, response);
  }
}
